package com.xls.future.presenter;

import android.content.Context;
import android.util.Log;

import com.xls.future.entity.VideoInfo;
import com.xls.future.model.FindModel;
import com.xls.future.model.FindModelImpl;
import com.xls.future.view.FindView;

import java.util.List;

import rx.Subscriber;

/**
 * Created by Administrator on 2017/10/17.
 */

public class FindPresenterImpl implements FindPresenter {

    private Context context;
    private FindView findView;
    private FindModel findModel;

    public FindPresenterImpl(Context context, FindView findView) {
        this.context = context;
        this.findView = findView;
        findModel = new FindModelImpl();
    }

    @Override
    public void loadVideoInfos() {
        findModel.loadVideoInfos(context, new Subscriber<List<VideoInfo>>() {
            @Override
            public void onCompleted() {

            }

            @Override
            public void onError(Throwable throwable) {

            }

            @Override
            public void onNext(List<VideoInfo> videoInfos) {
                Log.d("find","查询成功：共"+videoInfos.size()+"条数据。");
                findView.bindDataToList(videoInfos);
            }
        });
    }
}
